<?=$header?>
<script src="<?=base_url();?>system/scriptaculous/lib/prototype.js" type="text/javascript"></script>
<script src="<?=base_url();?>system/scriptaculous/src/scriptaculous.js" type="text/javascript"></script>
<script src="<?=base_url();?>system/scriptaculous/src/unittest.js" type="text/javascript"></script>

<script language="javascript" type="text/javascript">
function deleteUser(id){
	if(confirm('Are you sure you want to delete this user?')){
		window.location="<?=base_url();?>users/delete/"+id;
	} 
}
</script>

<p>
<?
$query = $this->db->query("SELECT ID, user_login, user_pass, user_email, user_url FROM gcms_users");

echo '<table border="0" cellpadding="2" cellspacing="0" style="width:100%">';
echo '<thead style="background:#464646;color:#D7D7D7;height:30px;"><th>id</th><th>username</th><th>email</th><th>website</th><th>action</th></thead>';
echo'<tbody>';
$i = 0;
foreach ($query->result() as $row)
{
	if($i == 0) $colour = "#F4F4F4"; 
	else $colour = "#E4E4E4"; 
	
	echo '<tr style="background:'.$colour.';"><td style="height:30px;">'.$row->ID.'</td><td>'.$row->user_login.'</td><td>'.$row->user_email.'</td><td>'.$row->user_url.'</td><td><a href="'.base_url().'users/edit/'.$row->ID.'">edit</a> | <a href="#" onclick="deleteUser(\''.$row->ID.'\');">delete</a></td></tr>';
	
	$i++;
	if($i > 1) $i = 0;
}
echo'</tbody>';
echo'</table>';
?>

<br />
<div class="option_box">
	<a onclick="Effect.toggle('new_box', 'slide');"><h2>Add New User</h2></a>
	<div id="new_box" style="display:none;">
		<? 
		echo form_open('users/create');
		echo '<table>';
		echo '<tr><td>Username</td><td>'.form_input('user', '').'</td></tr>'; 
		echo '<tr><td>Password</td><td>'.form_password('pass', '').'</td></tr>'; 
		echo '<tr><td colspan="2">'.form_submit('submit', 'Add User').'</td></tr>';
		echo '</table>';
		echo form_close();
		?>
	</div>
</div>
</p>

<?=$footer?>

</body>
</html>